
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, X =:= 2, X1 is 0, Y1 = Y, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, X > 2, (X -2) >= Y, (3 - X + 2) >= (3 - Y), X1 is X - 2, Y1 = Y, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, X =:= 1, X1 is 3, Y1 = Y, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - X) > 2, (3 - X - 2) >= (3 - Y), (X + 2) >= Y, X1 is X + 2, Y1 = Y, Z1 is 0.
	
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, X =:= 1, X1 is 0, Y1 = Y, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, X > 1, (X - 1) >= Y, (3 - X + 1) >= (3 - Y), X1 is X - 1, Y1 = Y, Z1 is 1. 
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, X =:= 2, X1 is 3, Y1 = Y, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - X) > 1, (3 - X - 1) >= (3 - Y), (X + 1) >= Y, X1 is X + 1, Y1 = Y, Z1 is 0.

	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, Y >= 2, X =:= 3, X1 = X, Y1 is Y - 2, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, Y >= 2, (3 - X) >= (3 - Y + 2), X1 = X, Y1 is Y - 2, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) =:= 2, X =:= 0, X1 = X, Y1 is Y + 2, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) =:= 2, X =:= 3, X1 = X, Y1 is Y + 2, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) =:= 2, X >= (Y + 2), (3 - X) >= (3 - Y - 2), X1 = X, Y1 is Y + 2, Z1 is 0.

	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, Y >= 1, X =:= 3, X1 = X, Y1 is Y - 1, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, Y >= 1, (3 - X) >= (3 - Y + 1), X1 = X, Y1 is Y - 1, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, Y > 1, X >= (Y - 1), (3 - X) >= (3 - Y + 1), X1 = X, Y1 is Y - 1, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) >= 1, X =:= 0, X1 = X, Y1 is Y + 1, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) >= 1, X >= (Y + 1), X1 = X, Y1 is Y + 1, Z1 is 0.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - Y) > 1, (3 - X) >= (3 - Y - 1), X >= (Y + 1), X1 = X, Y1 is Y + 1, Z1 is 0.

	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 0, X >= 1, Y >= 1, (3 - X + 1) >= (3 - Y + 1), X1 is X - 1, Y1 is Y - 1, Z1 is 1.
	move(state([X,Y,Z]),state([X1,Y1,Z1])):- Z =:= 1, (3 - X) >= 1, (3 - Y) >= 1, (X + 1) >= (Y + 1), X1 is X + 1, Y1 is Y + 1, Z1 is 0.
	
	algorithm(dfs). /*dfs or brfs*/

	mywrite(state([X,Y,Z])):-
		write(X), write(Y), write(Z), nl.


	go_p(state([3,3,0])).

	isGoal(state([0,0,1])).
